package com.santu.com.util;

import cn.hutool.crypto.SecureUtil;
import org.aspectj.lang.ProceedingJoinPoint;

import java.util.Map;

/**
 * @author luoyaoqi
 * @createTime 2022/7/8
 * @description
 */
public class ApiLockKeyDefaultGenerateStrategy implements ApiLockKeyGenerateStrategy {
    @Override
    public String generateKey(String prefix, Map<String, Object> params) {
        return prefix + SecureUtil.md5(params.toString());
    }

    @Override
    public String getKeyPrefix(ProceedingJoinPoint thisJoinPoint) {
        return thisJoinPoint.getTarget().getClass().getName() + "#" + thisJoinPoint.getSignature().getName() + "-";
    }
}
